package com.hlz.rabbit.mq.topic;

import com.hlz.rabbit.mq.util.RabbitMqUtils;
import com.rabbitmq.client.Channel;

import java.io.IOException;
import java.util.concurrent.TimeoutException;

/**
 * @author Hongliang Zhu
 * @create 2022-11-21 20:56
 */
public class TopicConsumer2 {

    public static void main(String[] args) throws IOException, TimeoutException {
        Channel channel = RabbitMqUtils.getChannel();

        channel.basicConsume("test-queue2", (consumerTag, message) -> {
            System.out.println("TopicConsumer2 接收到消息："+ new String(message.getBody()));
        }, consumerTag -> {

        });

    }
}
